﻿<%@ page contentType="text/html;charset=utf-8" language="java" %>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>管理问卷</title>
    <link href="../plugins/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../plugins/material-design-iconic-font-2.2.0/css/material-design-iconic-font.min.css" rel="stylesheet"/>
    <link href="../plugins/bootstrap-table-1.11.0/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="../plugins/waves-0.7.5/waves.min.css" rel="stylesheet"/>
    <link href="../plugins/jquery-confirm/jquery-confirm.min.css" rel="stylesheet"/>
    <link href="../plugins/select2/css/select2.min.css" rel="stylesheet"/>
    <link href="../css/common.css" rel="stylesheet"/>
</head>
<body onload="checkForm()">
<div id="main">
    <div id="toolbar">
        <a class="waves-effect waves-button" href="javascript:;" onclick="createAction()"><i class="zmdi zmdi-plus"></i> 新增问卷</a>
        <a class="waves-effect waves-button" href="javascript:;" onclick="updateAction()"><i class="zmdi zmdi-edit"></i> 编辑问卷</a>
        <a class="waves-effect waves-button" href="javascript:;" onclick="resultAction()"><i class="zmdi zmdi-edit"></i> 结果统计</a>
        <a class="waves-effect waves-button" href="javascript:;" onclick="deleteAction()"><i class="zmdi zmdi-close"></i> 删除问卷</a>
    </div>
    <table id="table"></table>
</div>
<!-- 新增 -->
<div id="createDialog" class="crudDialog" hidden>
    <form action="/client/add" method="get"  id="form1">
        <div class="form-group">
<%--            <label for="questionnaire_id">问卷编号</label>--%>
            问卷编号<input id="questionnaire_id" name="questionnaire_id" type="number" min="1" class="form-control"/>
        </div>
        <div class="form-group">
<%--            <label for="inputTitle">问卷名称</label>--%>
            问卷名称<input id="title" name="title" type="text" class="form-control"/>
        </div>
        <div class="form-group">
<%--            <label for="inputStart">起始时间</label>--%>
            起始时间<input id="start_time" name="start_time" type="datetime-local" class="form-control"/>
        </div>
        <div class="form-group">
<%--            <label for="inputEnd">结束时间</label>--%>
            结束时间<input id="end_time" name="end_time" type="datetime-local" class="form-control"/>
        </div>
        <input type="submit" class="btn btn-info" value="提交">
    </form>
</div>

<%--删除问卷--%>
<div id="deleteDialog" class="crudDialog" hidden>
    <form action="/client/delete" method="get"  id="form2">
        <div class="form-group">
            <%--            <label for="questionnaire_id">问卷编号</label>--%>
            问卷编号<input id="questionnaire_id" name="questionnaire_id" type="number" min="1" class="form-control"/>
        </div>

        <input type="submit" class="btn btn-info" value="提交" >
    </form>
</div>

<%--问卷结果--%>
<div id="resultDialog" class="crudDialog" hidden>
    <form action="/client/show" method="get"  id="form4">
        <div class="form-group">
            <%--            <label for="questionnaire_id">问卷编号</label>--%>
            问卷编号<input id="questionnaire_id" name="questionnaire_id" type="number" min="1" class="form-control"/>
        </div>
        <input type="submit" class="btn btn-info" value="提交" >
    </form>
</div>

<%--编辑问卷--%>
<div id="editDialog" class="crudDialog" hidden>
    <form action="/client/edit" method="post"  id="form3">
        <div class="form-group">
            <%--            <label for="questionnaire_id">问卷编号</label>--%>
            问卷编号<input id="questionnaire_id" name="questionnaire_id" type="number" min="1" class="form-control"/>
        </div>
        <input type="submit" class="btn btn-info" value="提交" formmethod="post" formaction="/client/edit" onclick="route()">
    </form>
</div>

<script src="../plugins/jquery.1.12.4.min.js"></script>
<script src="../plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
<script src="../plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
<script src="../plugins/bootstrap-table-1.11.0/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="../plugins/waves-0.7.5/waves.min.js"></script>
<script src="../plugins/jquery-confirm/jquery-confirm.min.js"></script>
<script src="../plugins/select2/js/select2.min.js"></script>
<script src="../js/common.js"></script>
<script src="../js/user.js" charset="UTF-8"></script>
<script>
    function route() {
        window.parent.location.href = "../../jsp/CreateQuestionnaire.jsp";
    }

    function resultAction() {
        $.confirm({
            type: 'green',
            animationSpeed: 300,
            centered: true,
            title: '问卷结果',
            content: $('#resultDialog').html(),
            buttons: {
                cancel: {
                    text: '取消',
                    btnClass: 'waves-effect waves-button'
                }
            }
        });
    }
    function checkForm() {
        var flag = '<%=request.getAttribute("message")%>';
        if(flag != "null") {
            alert(flag);
            $("#username").attr("value","");
            $("#password").attr("value","");
        }
    }
</script>
</body>
</html>